/*
 * Player.h
 *
 *  Created on: 21-08-2012
 *      Author: szymon
 */

#ifndef PLAYER_H_
#define PLAYER_H_

#include <SDL/SDL.h>
#include "Screen.h"
#include <vector>
#include "Flame.h"

using namespace std;

const int PLAYER_SCALE = 3;
const int PLAYER_WIDTH = 35 * PLAYER_SCALE;
const int PLAYER_HEIGHT = 50 * PLAYER_SCALE;
const int PLAYER_Y_OFFSET = 15;

const int SPRITES_NUM = 12;

class Player
{
private:
	enum Direction
	{
		left,
		right
	};

	enum Position
	{
		crouch,
		run,
		jump
	};
	//The areas of the sprite sheet
	SDL_Rect clipsRight[SPRITES_NUM];
	SDL_Rect clipsLeft[SPRITES_NUM];
	SDL_Rect clipCrouchRight;
	SDL_Rect clipCrouchLeft;
	SDL_Rect camera;

	SDL_Surface *playerSurface;
	Screen *screen;
	vector<Flame *> * flames;

	int offSet;
	int velocity;
	int frame;
	enum Direction	direction;
	enum Position	position;
	bool flameGeneration;

private:
	void setClips(void);
	void showStand(void);
	void showCrouch(void);

public:
	//Initializes the variables
	Player(Screen * screen, vector<Flame *> * flames);
	~Player();

	void handleEvents(SDL_Event * event);
	void move();
	SDL_Rect setCamera();
	void show();
};

#endif /* PLAYER_H_ */
